package com.example.demo.controller;

import com.example.demo.config.BeanConfig;
import com.example.demo.config.UserConfiguration;
import com.example.demo.model.UserInfo;
import com.example.demo.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

@Controller  //控制器存储
//将对象存储到Spring中
public class UserController {
    //属性注入
    @Autowired
    private UserService userService;
    @Autowired
//    @Qualifier("user2")
    private UserInfo userInfo;

//    @Resource(name="user2")
//    private UserInfo userInfo;

    public void sayHi(){
        System.out.println(userInfo);
        userService.sayHi();
        System.out.println("hi UserController...");
        System.out.println("------------------");
    }
}
